@namespace BootstrapBlazor
@inherits BootstrapComponentBase
@typeparam TValue

<li @ref="@Element" class="@Classname" style="@Style" @attributes="@AdditionalAttributes">
    @if (HasChildren)
    {
        <div class="treeview-item-header">
            <button class="btn-close" @onclick="@OnOpenChanged"></button>
            <label class="@TitleClassname" @onclick="@OnClickItemAsync">
                @if (Root?.MultiSelection == true)
                {
                    <BootstrapCheckbox Value="@Checked" ValueChanged="@OnCheckedChanged" />
                }
                @Title
            </label>
        </div>
        <BootstrapCollapse Open="@_opened">
            <ul class="treeview list-group">
                <CascadingValue Value="@this" IsFixed>
                    @ChildContent
                </CascadingValue>
            </ul>
        </BootstrapCollapse>
    }
    else
    {
        <label class="@TitleClassname" @onclick="@OnClickItemAsync">
            @if (Root?.MultiSelection == true)
            {
                <BootstrapCheckbox Value="@Checked" ValueChanged="@OnCheckedChanged" />
            }
            @Title
        </label>
    }
</li>